package org.spring.springboot.app.hard.hardlog.service.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spring.springboot.app.agent.balancelog.dao.SysOfficeBalanceLogDao;
import org.spring.springboot.app.agent.balancelog.domain.po.SysOfficeBalanceLogPO;
import org.spring.springboot.app.agent.balancelog.domain.vo.SysOfficeBalanceLogSearchVO;
import org.spring.springboot.app.hard.hardlog.dao.HardLogDao;
import org.spring.springboot.app.hard.hardlog.domain.po.HardLogPO;
import org.spring.springboot.app.hard.hardlog.domain.vo.HardLogCountVO;
import org.spring.springboot.app.hard.hardlog.domain.vo.HardLogFlowVO;
import org.spring.springboot.app.hard.hardlog.domain.vo.HardLogNumberVO;
import org.spring.springboot.app.hard.hardlog.domain.vo.HardLogVO;
import org.spring.springboot.app.hard.hardlog.service.IHardLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HardLogServiceImpl implements IHardLogService {

    private static final Logger LOGGER = LoggerFactory.getLogger(HardLogServiceImpl.class);

    @Autowired
    private HardLogDao hardLogDao;


    @Override
    public HardLogPO find(String id) {
        return hardLogDao.selectByPrimaryKey(id);
    }

    @Override
    public int save(HardLogPO po) {
        po.preInsert();
        return hardLogDao.insertSelective(po);
    }

    @Override
    public int update(HardLogPO po) {
        po.preUpdate();
        return hardLogDao.updateByPrimaryKeySelective(po);
    }

    @Override
    public int delete(String id) {
        HardLogPO po = new HardLogPO();
        po.setId(id);
        po.preDelete();
        return hardLogDao.updateByPrimaryKeySelective(po);
    }

    @Override
    public int deletes(String ids) {
        HardLogPO record = new HardLogPO();
        String[] id_s = ids.split(",");
        record.preDelete();
        int count = 0;
        for (String id : id_s) {
            record.setId(id);
            count += hardLogDao.updateByPrimaryKeySelective(record);
        }
        return count;
    }

    @Override
    public List<HardLogVO> findGraphical(String officeId) {
        return hardLogDao.findGraphical(officeId);
    }

    @Override
    public List<HardLogCountVO> findCount(String officeId) {
        return hardLogDao.findCount(officeId);
    }

    @Override
    public List<HardLogNumberVO> TotalNumber(String officeId) {
        return null;
    }

    @Override
    public List<HardLogFlowVO> findFlow(String officeId) {
        return null;
    }


}
